var app = getApp();
var memberUtil=require('../../utils/memberUtil');
Page({
  data: {
    userInfo:null
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function () {
    var that=this;
    that.setData({
      userInfo:wx.getStorageSync("loginUserInfo").userInfo==undefined?"":wx.getStorageSync("loginUserInfo").userInfo,
    })
    if(that.data.userInfo.id==undefined) {
      memberUtil.getLogin(app,0,1,that,2);
    }
  },
  //卡卷提示
  kajuan:function(){
    wx.showToast({
      title: '此模块工程师正在积极升级，敬请期待！',
      icon: 'none',
      duration: 3000
    })
    return false;
  },
  onReady: function () {
    // 生命周期函数--监听页面初次渲染完成

  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that=this;
    var memberIdJson = { memberId:that.data.userInfo.id}
    wx.request({
      url: app.globalData.baseUrl+ '/member/findICCCGByMemberId',
      method: 'POST',
      data: JSON.stringify(memberIdJson),
      success:function(e){
        if(e.statusCode==200){
          var vip=Number(e.data.data.memberGrade.replace("vip",""));
          that.setData({
            mycahuo:e.data.data,
            vip:vip
          })
        }
      },
      fail:function(){

      }
    })
  },
  //提现
  tixian:function(){
    wx.navigateTo({
      url: "/pages/my/commission"
    })
  },
  onHide: function () {
    // 生命周期函数--监听页面隐藏

  },
  onUnload: function () {
    // 生命周期函数--监听页面卸载

  },
  onPullDownRefresh: function () {
    // 页面相关事件处理函数--监听用户下拉动作

  },
  onReachBottom: function () {
    // 页面上拉触底事件的处理函数

  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    var that=this;
    console.log("页面内转发 / pages/shop/myAccount?parentId = " + that.data.userInfo.id+ " & enterType=0");
    return {
      title: '我的二维码',
      path: "/pages/shop/shareSuccess?parentId=" + that.data.userInfo.id + "&enterType=0",
      imageUrl: app.globalData.loginUserInfo.erweimaUrl
    }
  }
})